package concurrent.demo3;

import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author: zhenzhong.wang@honeywell.com
 * @Date: 2019/4/1/001 下午 8:27
 */
public class CyclicTest {
  public static void main(String[] args) {
    ExecutorService executor = Executors.newFixedThreadPool(3);
    CyclicBarrier cyclicBarrier = new CyclicBarrier(3);

    CycWork work1 = new CycWork(cyclicBarrier, "张1");
    CycWork work2 = new CycWork(cyclicBarrier, "张2");
    CycWork work3 = new CycWork(cyclicBarrier, "张3");

    executor.execute(work1);
    executor.execute(work2);
    executor.execute(work3);
    executor.shutdown();
  }
}
